#!/usr/bin/env python3
# -*- coding: utf-8 -*-


import sqlite3

conn = sqlite3.connect('sqllite.db')
cursor = conn.cursor()
cursor.execute('create table user1 (id varchar(20) primary key, name varchar(20))')
cursor.execute('insert into user1 (id, name) values (\'1\', \'Michael\')')
print(cursor.rowcount)
conn.commit()
cursor.execute('select * from user1 where id=?', ('1',))
values = cursor.fetchall()
print(values)

cursor.close()
conn.close()

#pip install mysql-connector

import mysql.connector

conn = mysql.connector.connect(user='prnp', password='prnp', database='tongjidb',host='10.12.12.141')
cursor = conn.cursor()


cursor.execute('create table user1 (id varchar(20) primary key, name varchar(20))')
cursor.execute('insert into user1 (id, name) values (%s, %s)', ['1', 'Michael'])

conn.commit()

cursor.execute('select * from user1 where id = %s', ('1',))
values = cursor.fetchall()
print(values)
cursor.close()
conn.close()


#pip install sqlalchemy














